<h3>Cập nhật nhà cung cấp</h3>
<hr />

<?php echo validation_errors() ?>
  
<form name="updateform" method="post" action="<?php echo base_url()?>index.php/provider/update/<?php echo $id ?>" enctype="multipart/data-form"> 
	<p></p>
	 <input type ="hidden" name ="id" value ="<?php echo $id;?>">
	 <table style="margin-left: 50px;" cellpadding="10">
		<tr>
			<td><label for = "name">Tên công ty</label></td>
			<td><input type="text" name="name"  size="100" value="<?php echo $name ?>"/></td>
		</tr>
		<tr>
			<td><label for = "logo">Logo</label></td>
			<td><img src="<?php echo base_url().$logo?>" /></td>
		</tr>
		<tr>
			<td>Upload new Logo</td>
			<td>
				<input type = "file" name = "logo" >
			</td>
		</tr>
		<tr>
			<td><label for = "phone">Số điện thoại</label></td>
			<td><input type="text" name="phone" size="100"  value="<?php echo $phone ?>"/></td>
		</tr>
		<tr>
			<td><label for = "email">Email</label></td>
			<td><input type="text" name="email" size="100"  value="<?php echo $email ?>"/></td>
		</tr>
		<tr>
			<td><label for = "address">Địa chỉ</label></td>
			<td><input type="text" name="address" size="100"  value="<?php echo $address ?>"/></td>
		</tr>
		<tr>
			<td><label for = "district">Quận</label></td>
			<td><input type="text" name="district" size="100"  value="<?php echo $district ?>"/></td>
		</tr>
		<tr>
			<td><label for = "province">Tỉnh/thành phố</label></td>
			<td><input type="text" name="province" size="100"  value="<?php echo $province ?>"/></td>
		</tr>
		<tr>
			<td><label for = "country" size="100" >Quốc gia</label></td>
			<td><input type="text" name="country" value="<?php echo $country ?>"/></td>
		</tr>
		<tr>
			<td><label for = "map">Bản đồ</label></td>
			<td><img src="<?php echo base_url().$map?>" /></td>
		</tr>
		<tr>
			<td>Cập nhật bản đồ</td>
			<td>
				<input type = "file" name = "map" >
			</td>
		</tr>
		<tr>
			<td><label for= "short_intro">Giới thiệu ngắn</label></td>
			<td><textarea name = "short_intro" id="short_intro_editor">
				<?php echo $short_intro?>
			</textarea>
			<?php echo display_ckeditor($short_intro_editor)?>
			</td>	
		</tr>
		<td><label for= "introduction">Công ty giới thiệu</label></td>
		<td><textarea name = "introduction" id="intro_editor">
			<?php
				echo $introduction; 
			?>
		</textarea>
		<?php echo display_ckeditor($intro_editor)?>
		</td>	
		</tr>
		<tr>
			<td><label>Danh mục</label></td>
			<td>
				<?php foreach ($list_category as $item): ?>
					<input type = 'checkbox' name = "<?php echo 'cate'.$item['id'];?>" value = '<?php echo $item['id'];?>' 
					<?php
					foreach ($category as $cat):
						if($item['id']==$cat['category_id']){
							echo "checked";
						}
					endforeach;
					?> />
					<?php echo $item['categoryName']; ?>
				<?php endforeach;?>
			</td>
		</tr>
		<tr>
			<td><label>Chế độ giảm giá</label></td>
			<td>
				<?php foreach ($list_pricePolicy as $item): ?>
					<input type = 'checkbox' name = "<?php echo 'pp'.$item['id'];?>" value = '<?php echo $item['id'];?>' 
					<?php
					foreach ($pricePolicy as $pp):
						if($item['id']==$pp['pricepolicy_id']){
							echo "checked";
						}
					endforeach;
					?>>
					<?php echo $item['value']; ?>
				<?php endforeach;?>
			</td>
		</tr>
		<tr>
			<td><label>Chế độ thời gian</label></td>
			<td>
				<?php foreach ($list_timePolicy as $item): ?>
					<input type = 'checkbox' name = "<?php echo 'tp'.$item['id'];?>" value = '<?php echo $item['id'];?>' 
					<?php
					foreach ($timePolicy as $tp):
						if($item['id']==$tp['timepolicy_id']){
							echo "checked";
						}
					endforeach;
					?>>
					<?php echo $item['value']; ?>
				<?php endforeach;?>
			</td>
		</tr>
		<tr>
			<td><label>Cấp</label></td>
			<td>
			<select name = 'level'>
				<?php foreach ($list_level as $item): ?>
					<option name = '<?php 
						echo $item['level'];
					?>'
					<?php
						if($item['level']==$level){
						echo "selected";
					}
					?>
					><?php echo $item['level'];?></option>
				<?php endforeach;?>
			</select>
			</td>
		</tr>
		<tr>
			<td><label>Trạng thái</label></td>
			<td>
			<select name = 'status'>
				<option value = 'Active' <?php if($level = 'Active'){echo "selected";}?>>Active</option>
				<option value = 'Deactive'>Deactive</option>;
			</select>
			</td>
		</tr>
		<tr>
		<td><label for= "policy">Điều khoản sử dụng</label></td>
		<td><textarea name = "policy" id="poli_editor"><?php echo $policy; ?></textarea>
		<?php echo display_ckeditor($poli_editor)?>
		</td>	
		</tr>

		<tr>
		<td><label for= "userPolicy">Lưu ý khách hàng</label></td>
		<td><textarea name="userPolicy" id="upoli_editor"><?php echo $userPolicy; ?></textarea>
		<?php echo display_ckeditor($upoli_editor)?>
		</td>	
		</tr>

		<input type="hidden" value="Update" name="update">
		<tr><td>
		<input type="submit" name="submit" value="Lưu" />
		</td></tr>
	</table>
</form>
